package sng.modules.view.components.city.state
{
	import flash.display.MovieClip;
	
	import sng.modules.model.vo.BuildingVO;
	import sng.modules.view.components.city.logic.unit.BaseBuilding;
	import sng.utils.TimeUtil;

	/**
	 * 
	 * @author leonliu
	 * 此状态表示当前建筑处于刚建好状态，还需求操作2次"修理"才能算完成
	 * 
	 */	
	public class BuildNewState extends BuildState
	{
		public function BuildNewState()
		{
			//TODO: implement function
		}
		
		public override function setSkin(build:BaseBuilding):void
		{
			var mc:MovieClip = build.skin.getMC();
			try
			{
				mc.gotoAndStop("建造");
				if(mc.baseBuild_mc!=null)
					mc.baseBuild_mc.gotoAndStop("f"+build.currentStep);
			} 
			catch(error:Error) 
			{
				
			}
		}
		
		public override function execute(build:BaseBuilding):void
		{
			//1: 调用房子的修理升级功能，
			//2: 判断完成时修改房子的当前状态
			
			//设置建造好的建筑的UserBuildingVO
//			var vo:BuildingVO = build.vo;
//			build.uVO.countdown = vo.countdown;
//			build.uVO.countdownTime = Number(vo.countdown)+TimeUtil.getTimeSecond();
//			build.uVO.population = vo.populationDownLimit;
			//by leonliu 具体属性需要使用时再增加，可以策略类的构造函数或具体步骤策略中增加数据的赋值
			
			build.upgrade();
		}
		
//		public override function toString():String
//		{
//			//TODO: implement function
//			return "BuildNewState";
//		}
		
		public override function getiStateType():uint
		{
			return 0;
		}
	}
}